# 进程是资源单位，每个进程至少有一个线程
# 线程是执行单位
from threading import Thread


# 启动每一个执行程序都默认会有一个主线程

"""
def func():
    for i in range(1000):
        print("func", i)

if __name__ == '__main__':
    t = Thread(target=func)  # 设定线程任务
    t.start()  # 线程任务就绪

    for i in range(1000):
        print("main", i)
"""



class MyThread(Thread):
    def run(self):
        for i in range(1000):
            print("子线程", i)

if __name__ == '__main__':
    t = MyThread()
    t.start()

    for i in range(1000):
        print("主线程", i)